﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Inspection.aspx.cs" Inherits="PPAP.Web.Todolist.Inspection" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        .table
        {
            background-color: #F2F2F2;
            border: 1px;
            border-color: Gray;
            border-style: solid;
            height: 140px;
            width: 95%;
            vertical-align: top;
            margin-left: 5px;
        }
        .td1
        {
            font-weight: bold;
            border-color: #2A48CE;
            border: 0px;
            color: #2E8AC5;
            margin: 0;
        }
        .td2
        {
            border-color: #2A48CE;
            border: 0px;
            margin: 0;
            border-top-width: 0;
        }
        .td3
        {
            border-color: #2A48CE;
            border: 0px;
            margin: 0;
            border-top-width: 0;
            border-left-width: 0;
        }
    </style>
</head>
<body style="font-family: Arial, Helvetica, sans-serif;">
    <form id="form1" runat="server">
    <div>
        <table width="100%" runat="server" id="ta">
            <tr style="color: #000000; background-color: #E7E8E8; font-weight: bold; height: 28px;">
                <td colspan="4">
                    Sample card
                </td>
            </tr>
            <tr>
                <td style="font-weight: bold; color: #2E8AC5; width: 20%; height: 25px;">
                    Sample card no.
                </td>
                <td style="width: 30%;">
                    <asp:Label ID="lblCardNo" runat="server"></asp:Label>
                </td>
                <td style="font-weight: bold; color: #2E8AC5; width: 20%;">
                    Department
                </td>
                <td style="width: 30%;">
                    <asp:Label ID="lblDepartment" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
        <br />
        <table width="100%" cellspacing="0" style="border-color: #2A48CE; border: 0px; border-style: solid;
            border-color: Gray; border-spacing: 0px;">
            <tr style="color: #000000; background-color: #E7E8E8; font-weight: bold; height: 28px;">
                <td colspan="4">
                    Inspection
                </td>
            </tr>
            <tr>
                <td style="width: 18%;" bgcolor="#F2F2F2" class="td1">
                    Result
                </td>
                <td style="width: 25%;" class="td2">
                    <asp:RadioButton ID="rbtG" runat="server" GroupName="a" Text="Release(green)" Checked="True" />
                    <table class="table">
                        <tr>
                            <td>
                                Definition green:<br />
                                &nbsp;·100%acceptable for customer
                                <br />
                                ·Achieves 100% compliance creteria defined by department conducting the assessment
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 25%;" class="td2">
                    <asp:RadioButton ID="rbtY" runat="server" GroupName="a" Text="Conditional release(yellow)" />
                    <table class="table">
                        <tr>
                            <td>
                                Definition yellow:<br />
                                &nbsp;·Suitable for customer
                                <br />
                                ·May remain in vehicle
                                <br />
                                ·Spec.non-conformity is present only on uncritical specifications
                            </td>
                        </tr>
                    </table>
                </td>
                <td style="width: 25%;" class="td2">
                    <asp:RadioButton ID="rbtR" runat="server" GroupName="a" Text="Rejected(red)" />
                    <table class="table">
                        <tr>
                            <td>
                                Definition Red:
                                <br />
                                ·not suitable for customer
                                <br />
                                ·must not remain in vehicle
                                <br />
                                ·re-sampling required without delay
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td bgcolor="#F2F2F2" class="td1">
                    Reason for deviation
                </td>
                <td colspan="3" class="td2">
                    <asp:TextBox ID="txtReason" runat="server" Height="80px" TextMode="MultiLine" Width="99%"
                        OnTextChanged="txtReason_TextChanged"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td bgcolor="#F2F2F2" class="td1">
                    Internal Comment
                </td>
                <td colspan="3" class="td3">
                    <asp:TextBox ID="txtInternalComment" runat="server" Width="99%" OnTextChanged="txtInternalComment_TextChanged"></asp:TextBox>
                </td>
            </tr>
        </table>
        <hr />
        <table width="100%">
            <tr>
                <td style="font-weight: bold;">
                    Upload inspection Report：
                </td>
                <td align="right">
                    <asp:Label ID="lblUp" runat="server" Visible="False"></asp:Label>
                </td>
            </tr>
            <tr style="height: 32px;" runat="server" id="trfile">
                <td align="right" style="font-weight: bold;" colspan="2">
                    File:
                    <asp:FileUpload ID="file" runat="server" Width="645px" />
                    <asp:Button ID="Button3" runat="server" CssClass="button" OnClick="Button3_Click"
                        Text="Upload" OnClientClick="return confirm('Are you sure you want to upload?');" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:GridView ID="GridView1" runat="server" CellPadding="4" Width="100%" ForeColor="#333333"
                        GridLines="None" AutoGenerateColumns="False">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="No." ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("rownum") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="File name" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <a href='<%# GetLink(Eval("F_URL").ToString()) %>' style="display: none;" target="_blank">
                                        <span style="color: Blue;">
                                            <%# Eval("F_Filename")%></span></a>
                                    <asp:LinkButton ID="LinkButton3" Visible="true" Text='<%# Eval("F_URL") %>' runat="server"
                                        OnClick="LinkButton2_Click"><%# Eval("F_Filename")%></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Size" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Label ID="Label7" runat="server" Text='<%# Eval("filesize") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Create date" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Label ID="Label8" runat="server" Text='<%#Eval("UpTime").ToString()==""?"":DateTime.Parse(Eval("UpTime").ToString()).ToString("yyyy-MM-dd")  %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Create by" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Eval("UpBy") %>'></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center"></ItemStyle>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Delete" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" Visible='<%#Eval("F_ID").ToString()==""?false:false %>'
                                        runat="server" OnClientClick="return confirm('Please confirm to delete the file.')"
                                        PostBackUrl='<%# "Inspection.aspx?deid="+Eval("F_ID")%>'>Delete</asp:LinkButton>
                                    <img src="../Images/newimg/delete.png" title="Delete" onclick="<%#"javascript:del("+Eval("F_ID")+")" %>" />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#2E8AC5" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#2E8AC5" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="Button2" runat="server" CssClass="button" Text="Submit" OnClientClick="return check();"
                        OnClick="Button2_Click" />&nbsp;
                    <asp:Button ID="btnApprove" runat="server" CssClass="button" Text="Approve" OnClick="btnApprove_Click"
                        OnClientClick="return confirm('Are you sure you want to approve?');" Visible="False" />
                    &nbsp;
                    <asp:Button ID="btnReject" runat="server" CssClass="button" Text="Reject" OnClick="btnReject_Click"
                        OnClientClick="return confirm('Are you sure you want to reject?');" Visible="False" />
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
<script type="text/jscript" language="javascript">
    function del(id) {
        if (id > 0) {
            if (confirm('Please confirm to delete the file.')) {
                url = "Inspection.aspx?deid=" + id;
                window.location.href = url;
            }
        }
    }

    function check() {
        var txtReason = document.getElementById("txtReason");
        var rbtG = document.getElementById("rbtG");
        if (!rbtG.checked) {
            if (txtReason.value == "") {
                alert("'Reason for deviation' is mandatory for Yellow or Red result");
                txtReason.focus();
                return false;
            }
        }
        return confirm('Are you sure you want to submit?');
    }
</script>
</html>
